package admin.board.board_list.action;

import java.sql.SQLException;

import admin.board.board_list.dao.BoardlistDao;
import admin.board.board_list.dto.BoardlistDto;

import com.opensymphony.xwork2.ActionSupport;

@SuppressWarnings("serial")
public class ModifyAction extends ActionSupport {
	private BoardlistDao dao;
	private BoardlistDto dto;
	
	private int board_no;
	private int category_no;
	private String category_name;
	private String board_name;
	private int view_level;
	private String link_page;
	
	public ModifyAction() {
		dao = BoardlistDao.getInstance();
	}
	
	public String form() throws SQLException {
		dto = dao.selectOne(board_no);
		category_name = (String)dao.selectName(category_no);
		
		return SUCCESS;
	}
	
	public String execute() throws SQLException {
		dto = new BoardlistDto();
		dto.setAll(board_no, board_name, view_level, link_page, category_no);
		dao.update(dto);
		return SUCCESS;
	}

	public BoardlistDto getDto() {
		return dto;
	}
	
	public int getBoard_no() {
		return board_no;
	}

	public void setBoard_no(int board_no) {
		this.board_no = board_no;
	}

	public String getCategory_name() {
		return category_name;
	}
	
	public int getCategory_no() {
		return category_no;
	}

	public void setCategory_no(int category_no) {
		this.category_no = category_no;
	}

	public String getBoard_name() {
		return board_name;
	}

	public void setBoard_name(String board_name) {
		this.board_name = board_name;
	}

	public int getView_level() {
		return view_level;
	}

	public void setView_level(int view_level) {
		this.view_level = view_level;
	}

	public String getLink_page() {
		return link_page;
	}

	public void setLink_page(String link_page) {
		this.link_page = link_page;
	}
}
